﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.IO;
using Shine.Framework;



using System.Runtime.InteropServices;

namespace Shine.FlyManager
{
    public partial class RouteList : UserControl, ICommand
    {
        IApplication m_Application = null;
        public RouteList()
        {
            InitializeComponent();
        
            comboBoxEx1.Items.Clear();
          
            string path = Application.StartupPath + "\\飞行路线";
            if (System.IO.Directory.Exists(path) == false) return;
            string[] files = System.IO.Directory.GetFiles(path, "*.fpf", SearchOption.AllDirectories);
            foreach (string str in files)
            {
                string name = System.IO.Path.GetFileNameWithoutExtension(str);
                comboBoxEx1.Items.Add(name);

            }
        }

        #region ICommand Members

        int ICommand.Bitmap
        {
            get { return 0; }
        }

        string ICommand.Caption
        {
            get { return "RouteList"; }
        }

        string ICommand.Category
        {
            get { return "飞行路线"; }
        }

        bool ICommand.Checked
        {
            get { return false; }
        }

        bool ICommand.Enabled
        {
            get
            {
                return true;
            }
        }

        int ICommand.HelpContextID
        {
            get { return 0; }
        }

        string ICommand.HelpFile
        {
            get { return string.Empty; }
        }

        string ICommand.Message
        {
            get { return "RouteList"; }
        }

        string ICommand.Name
        {
            get { return "RouteList"; }
        }

        void ICommand.OnClick()
        {
        }

        void ICommand.OnCreate(object hook)
        {
          
           
                m_Application = hook as IApplication;
             
        }

     
        string ICommand.Tooltip
        {
            get { return "飞行路线"; }
        }

        #endregion

    
      

        private void comboBoxEx1_KeyDown(object sender, KeyEventArgs e)
        {
            
        }

        private void comboBoxEx1_SelectedIndexChanged(object sender, EventArgs e)
        {
          

          (m_Application as IFramework).SelectedRoute = comboBoxEx1.SelectedItem == null ? "" : comboBoxEx1.SelectedItem.ToString();
        }
    }
}
